import UIKit

var s1: Set<Int> = [2, 4, 5]
var s2 = Set([3, 2, 5])

s2.count
s2.isEmpty

s2.contains(2)

//插入元素
let (removedSuccessfully,item) = s2.insert(6)
print(removedSuccessfully,item)

s2.remove(2)
s2.removeAll()

// 集合运算
s1.union(s2) // 并集
s1.intersection(s2) // 交集
s1.subtract(s2) // 差集
s1.symmetricDifference(s2) // 对称差集

s1.isSubset(of: s2)
s1.isSubset(of: s2)
s1.isStrictSubset(of: s2)
s1.isStrictSuperset(of: s2)

s1.isDisjoint(with: s2)

s1.randomElement()

for item in s1 {
  print(item)
}

for (k, v) in s1.enumerated() {
  print(k, v)
}

s1.forEach { item in
	print("---\(item)")
}
